package sipoc.license;

import java.util.Map;
import java.util.WeakHashMap;

import org.springframework.stereotype.Component;

@Component
public class LicenseManager {

	private Map<String, String> licenseMock = new WeakHashMap<String, String>();

	/**
	 *
	 * @param assetId
	 * @param license
	 */
	public void store(String countryCode, String assetId, String license) {
		licenseMock.put(getKey(countryCode, assetId), license);
	}

	/**
	 *
	 * @param assetId
	 * @return
	 */
	public String getLicense(String countryCode, String assetId) {
		return licenseMock.get(getKey(countryCode, assetId));
	}

	private String getKey(String countryCode, String assetId) {
		return countryCode + ":" + assetId;
	}
}
